Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove reward address, clean up mining addr #729

Merged
merged 11 commits into from
Aug 17, 2018

Conversation

whyrusleeping
Copy link
Member

No description provided.

@whyrusleeping
Copy link
Member Author

Still getting a strange error while trying to mine:

Problem mining a block: bad miner address, miner must store files before mining

Which I wasnt getting before rebasing... Will investigate further

Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great from the perspective of someone who deals with the mining code. I've got a comment on waiting to make Mine a member function or at least not investing too much in changing test structures around this new pattern. Will approve after test fixes come through.

As I understand it, now that the miner actor is the recipient of block rewards we need a system for claiming rewards as the miner owner. It might be helpful to see the issue tracking that work linked here.

@@ -165,7 +162,7 @@ type mineFunc func(ctx context.Context, input Input, nullBlockTimer NullBlockTim
type NullBlockTimerFunc func()

// Mine does the actual work. It's the implementation of worker.mine.
func Mine(ctx context.Context, input Input, nullBlockTimer NullBlockTimerFunc, blockGenerator BlockGenerator, createPoST DoSomeWorkFunc, outCh chan<- Output) {
func (w *AsyncWorker) Mine(ctx context.Context, input Input, outCh chan<- Output) {
Copy link
Contributor

@ZenGround0 ZenGround0 Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like what you are doing here and just flagging that you can keep the test fixup in an ugly state because the changes coming in #722 will make things nicer. Alternatively we could wait to do this in #722.

As I understand it the reason Mine was a free function hanging around inside w.mine was to facilitate testing by allowing test runs to easily compose the production Start function with a mock Mine function, and to test Mine on its own.

I think fixing tests as things are is doomed to make things ugly because the thing that calls Mine also needs to have a Start method, and without the mine member function workaround I think you'll have to copy paste the Start method on a test worker. There might be more-involved less-ugly workarounds in the context of this PR, but you shouldn't worry about those. In PR #722 I'm separating the Start and Mine behavior to different interfaces which should make creating test instances easier because everything will be talking to an interface that can be swapped for tests.

@ZenGround0
Copy link
Contributor

@whyrusleeping it looks like that error message, which I agree needs to be made more informative, is coming from the power table's HasPowercheck. When running into the same error locally the issue was that I was using a mining address not specified as having power in the input genesis block. After getting bob's address into the wallet and the mining.minerAddresses array of the config this error goes away.

Unfortunately after doing this mining start now panics. The panic comes from power_table_view.go:78 and the root cause is that the mining actor instantiated by gengen has a nil Head.

@whyrusleeping
Copy link
Member Author

It mines!

return nil, err
}

return &act, nil
}

func hackTransferObject(from, to interface{}) error {
m := obj.NewMarshaller(cbor.CborAtlas)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a local hack, this doesn't work for me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops. That was def a local hack. lemme fix up

@dignifiedquire
Copy link
Contributor

things are getting better, but still some tests broken

interesting bits I did

  • improve gengen to use the regular genesis + account actors
  • use gengen keys and genesis block for all command tests
  • hack: set the default address if none is set, to the first one returned from the backend on first call
  • hack many tests

whyrusleeping and others added 4 commits August 16, 2018 11:56
more tests are passing, less reward address

node tests are passing

wip - fixing all the tests

more tests passing, gengen is getting put to work

fix repo and config tests

more reward address cleansing
@eefahy
Copy link
Contributor

eefahy commented Aug 16, 2018

getting the following init failure

go-filecoin init --genesisfile=/home/kitty/kitty-car/genesis.car --repodir=/home/kitty/filecoins/0
initializing filecoin node at /home/kitty/filecoins/0
Error: malformed stream: invalid appearance of string token; expected start of map

@dignifiedquire
Copy link
Contributor

@eefahy which commit did you use to build gengen and which commit are you on when getting that error?

@whyrusleeping whyrusleeping force-pushed the feat/down-with-reward-addr branch from 9fe2b5d to 95aa8b6 Compare August 16, 2018 23:33
@whyrusleeping whyrusleeping force-pushed the feat/down-with-reward-addr branch from 95aa8b6 to 58c4083 Compare August 16, 2018 23:51
@whyrusleeping whyrusleeping merged commit 6b471f1 into master Aug 17, 2018
@whyrusleeping whyrusleeping deleted the feat/down-with-reward-addr branch August 17, 2018 00:30
func (v *marketView) HasPower(ctx context.Context, st state.Tree, cstore *hamt.CborIpldStore, mAddr types.Address) bool {
numBytes, err := v.Miner(ctx, st, cstore, mAddr)
if err != nil {
panic(err) //hey guys, dropping errors is BAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have sinned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants