Skip to content
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
3 changes: 1 addition & 2 deletions core/adapters/eth_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ func (e *EthTx) TaskType() models.TaskType {
func (e *EthTx) Perform(input models.RunInput, store *strpkg.Store) models.RunOutput {
if store.Config.EnableBulletproofTxManager() {
return e.perform(input, store)
} else {
return e.legacyPerform(input, store)
}
return e.legacyPerform(input, store)
}

// TODO(sam): https://www.pivotaltracker.com/story/show/173280188
Expand Down
12 changes: 11 additions & 1 deletion core/adapters/eth_tx_abi_encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"math/big"
"regexp"
"strings"

"github.com/pkg/errors"

Expand Down Expand Up @@ -143,7 +144,7 @@ func abiEncode(fnABI *abi.Method, args map[string]interface{}) ([]byte, error) {
panic("unexpected size of static part")
}

result := fnABI.ID()
result := functionSelector(fnABI)
result = append(result, encodedStaticPart...)
result = append(result, encodedDynamicPart...)
return result, nil
Expand Down Expand Up @@ -457,3 +458,12 @@ func assertPadded(b []byte) {
panic("ABI encoded data isn't padded properly")
}
}

func functionSelector(fnABI *abi.Method) []byte {
types := []string{}
for _, input := range fnABI.Inputs {
types = append(types, input.Type.String())
}
signature := fmt.Sprintf("%v(%v)", fnABI.Name, strings.Join(types, ","))
return utils.MustHash(signature).Bytes()[:4]
}
20 changes: 4 additions & 16 deletions core/adapters/eth_tx_abi_encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,10 @@ func TestEthTxABIEncodeAdapter_Perform_ConfirmedWithJSON(t *testing.T) {
Name: "verifyVRFProof",
RawName: "verifyVRFProof",
Inputs: []abi.Argument{
abi.Argument{
Name: "gammaX",
Type: uint256Type,
},
abi.Argument{
Name: "gammaY",
Type: uint256Type,
},
abi.Argument{
Name: "c",
Type: uint256Type,
},
abi.Argument{
Name: "s",
Type: uint256Type,
},
{Name: "gammaX", Type: uint256Type},
{Name: "gammaY", Type: uint256Type},
{Name: "c", Type: uint256Type},
{Name: "s", Type: uint256Type},
},
Outputs: []abi.Argument{},
},
Expand Down
4 changes: 2 additions & 2 deletions core/eth/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (cc *contractCodec) GetMethodID(method string) ([]byte, error) {
if !found {
return []byte{}, errors.New("unable to find contract method " + method)
}
return mabi.ID(), nil
return mabi.ID, nil
}

// MustGetV6ContractEventID finds the event for the given contract by searching
Expand All @@ -102,7 +102,7 @@ func MustGetV6ContractEventID(name, eventName string) common.Hash {
if !found {
logger.Panic(fmt.Errorf("unable to find event %s for contract %s", eventName, name))
}
return event.ID()
return event.ID
}

func (cc *contractCodec) UnpackLog(out interface{}, event string, log Log) error {
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading