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

fix message wait #4629

Merged
merged 3 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cmd/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ var stateWaitMsgCmd = &cmds.Command{
buf := new(bytes.Buffer)
writer := NewSilentWriter(buf)

writer.Printf("message was executed in tipset: %s\n", mw.TipSet.Cids())
writer.Printf("Exit Code: %d\n", mw.Receipt.ExitCode)
writer.Printf("Gas Used: %d\n", mw.Receipt.GasUsed)
writer.Printf("Return: %x\n", mw.Receipt.ReturnValue)
if mw != nil {
writer.Printf("message was executed in tipset: %s\n", mw.TipSet.Cids())
writer.Printf("Exit Code: %d\n", mw.Receipt.ExitCode)
writer.Printf("Gas Used: %d\n", mw.Receipt.GasUsed)
writer.Printf("Return: %x\n", mw.Receipt.ReturnValue)
} else {
writer.Printf("Unable to find message recepit of %s", cid)
}

return re.Emit(buf)
},
Expand Down
7 changes: 1 addition & 6 deletions pkg/chain/waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,7 @@ func (w *Waiter) findMessage(ctx context.Context, from *types.TipSet, m types.Ch
return nil, false, xerrors.Errorf("failed to load tipset during msg wait searchback: %w", err)
}

grandParent, err := w.chainReader.GetTipSet(pts.Parents())
if err != nil {
return nil, false, xerrors.Errorf("failed to load tipset during msg wait searchback: %w", err)
}

act, err := w.Stmgr.GetActorAt(ctx, m.VMMessage().From, grandParent)
act, err := w.Stmgr.GetActorAt(ctx, m.VMMessage().From, pts)
actorNoExist := errors.Is(err, types.ErrActorNotFound)
if err != nil && !actorNoExist {
return nil, false, xerrors.Errorf("failed to load the actor: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/wallet/dsbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ func (backend *DSBackend) HasAddress(addr address.Address) bool {
// NewAddress creates a new address and stores it.
// Safe for concurrent access.
func (backend *DSBackend) NewAddress(protocol address.Protocol) (address.Address, error) {
backend.lk.Lock()
defer backend.lk.Unlock()

switch protocol {
case address.BLS:
return backend.newBLSAddress()
Expand Down Expand Up @@ -176,14 +179,11 @@ func (backend *DSBackend) putKeyInfo(ki *crypto.KeyInfo) error {
return err
}

backend.lk.Lock()
if err := backend.ds.Put(ds.NewKey(key.Address.String()), keyJSON); err != nil {
return errors.Wrapf(err, "failed to store new address: %s", key.Address.String())
}
backend.cache[addr] = struct{}{}
backend.unLocked[addr] = ki
backend.lk.Unlock()

return nil
}

Expand Down