Skip to content

Commit

Permalink
Merge pull request #11 from quilt/aa-tests-retesteth
Browse files Browse the repository at this point in the history
Update Retesteth Integration to Support AA
  • Loading branch information
adietrichs authored Jun 8, 2020
2 parents 3ddc462 + 46ef9c2 commit f8e1997
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ type Message struct {
}

func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool) Message {
isAA := from.IsEntryPoint()
return Message{
from: from,
to: to,
Expand All @@ -417,7 +418,8 @@ func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *b
gasLimit: gasLimit,
gasPrice: gasPrice,
data: data,
checkNonce: checkNonce,
checkNonce: checkNonce && !isAA,
isAA: isAA,
}
}

Expand Down
12 changes: 8 additions & 4 deletions tests/state_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,15 @@ func (tx *stTransaction) toMessage(ps stPostState) (core.Message, error) {
// Derive sender from private key if present.
var from common.Address
if len(tx.PrivateKey) > 0 {
key, err := crypto.ToECDSA(tx.PrivateKey)
if err != nil {
return nil, fmt.Errorf("invalid private key: %v", err)
if len(tx.PrivateKey) == 1 && tx.PrivateKey[0] == 0xAA {
from = common.NewEntryPointAddress()
} else {
key, err := crypto.ToECDSA(tx.PrivateKey)
if err != nil {
return nil, fmt.Errorf("invalid private key: %v", err)
}
from = crypto.PubkeyToAddress(key.PublicKey)
}
from = crypto.PubkeyToAddress(key.PublicKey)
}
// Parse recipient if present.
var to *common.Address
Expand Down

0 comments on commit f8e1997

Please sign in to comment.