-
Notifications
You must be signed in to change notification settings - Fork 104
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
Use CreateActionID to give simulated actions unique actionID #1644
Conversation
The code LGTM |
@@ -194,8 +194,8 @@ func (cli *JSONRPCClient) GetABI(ctx context.Context) (abi.ABI, error) { | |||
return resp.ABI, err | |||
} | |||
|
|||
func (cli *JSONRPCClient) Execute(ctx context.Context, actor codec.Address, actions []chain.Action) ([][]byte, error) { | |||
actionsMarshaled := make([][]byte, 0) | |||
func (cli *JSONRPCClient) ExecuteActions(ctx context.Context, actor codec.Address, actions []chain.Action) ([][]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy it's been renamed back.
if len(args.Actions) == 0 { | ||
return errNoActionsToExecute | ||
} | ||
if maxActionsPerTx := int(j.vm.Rules(time.Now().Unix()).GetMaxActionsPerTx()); len(args.Actions) > maxActionsPerTx { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
// Get expected state keys | ||
stateKeysWithPermissions := action.StateKeys(args.Actor) | ||
|
||
// flatten the map to a slice of keys | ||
storageKeysToRead := make([][]byte, 0) | ||
storageKeysToRead := make([][]byte, 0, len(stateKeysWithPermissions)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
This PR uses
chain.CreateActionID(ids.Empty, actionIndex)
to make sure that each simulated action gets a unique actionID that won't conflict w/ any previous actionID.