Skip to content

Commit

Permalink
make action.Execute use actionID
Browse files Browse the repository at this point in the history
  • Loading branch information
wlawt committed Apr 25, 2024
1 parent 1febae9 commit 6bafde4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chain/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ type Action interface {
mu state.Mutable,
timestamp int64,
actor codec.Address,
txID ids.ID,
actionID codec.Address,
) (success bool, computeUnits uint64, output []byte, err error)
}

Expand Down
5 changes: 3 additions & 2 deletions chain/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ func (t *Transaction) Execute(
return []*Result{{false, utils.ErrBytes(rerr), maxUnits, maxFee}}, nil
}
results := make([]*Result, 0)
for _, action := range t.Actions {
success, actionCUs, output, err := action.Execute(ctx, r, ts, timestamp, t.Auth.Actor(), t.id)
for i, action := range t.Actions {
actionID := action.GetActionID(uint8(i), t.id)
success, actionCUs, output, err := action.Execute(ctx, r, ts, timestamp, t.Auth.Actor(), actionID)
if err != nil {
return handleRevert(err)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/morpheusvm/actions/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (t *Transfer) Execute(
mu state.Mutable,
_ int64,
actor codec.Address,
_ ids.ID,
_ codec.Address,
) (bool, uint64, []byte, error) {
if t.Value == 0 {
return false, 1, OutputValueZero, nil
Expand Down

0 comments on commit 6bafde4

Please sign in to comment.