Skip to content

Commit

Permalink
Fix 4byte bug (autonity#185)
Browse files Browse the repository at this point in the history
* restore unmodified 4byte.json file
* fix generation of 4bytedb
* change ether to auton in cmdline

Co-authored-by: Lorenzo Alluminio <[email protected]>
  • Loading branch information
lorenzo-dev1 and Lorenzo Alluminio authored Sep 13, 2022
1 parent 1bfd177 commit 5ecab93
Show file tree
Hide file tree
Showing 6 changed files with 293,782 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ $(GENERATED_BYTECODE) $(GENERATED_RAW_ABI) $(GENERATED_ABI): $(AUTONITY_CONTRACT
@gofmt -s -w $(GENERATED_UPGRADE_BYTECODE)

# update 4byte selector for clef
go run build/generate_4bytedb.go
build/generate_4bytedb.sh $(SOLC_BINARY)
cd signer/fourbyte && go generate

$(SOLC_BINARY):
Expand Down
99 changes: 0 additions & 99 deletions build/generate_4bytedb.go

This file was deleted.

10 changes: 10 additions & 0 deletions build/generate_4bytedb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
SOLC_BIN="$1"
echo "{" > signer/fourbyte/autonity_4byte.json
$SOLC_BIN --hashes autonity/solidity/contracts/Autonity.sol 2>/dev/null | grep -E --color=never "^[0-9a-f]{8}: .*" | sed -E 's/^([0-9a-f]{8}): (.*)$/"\1": "\2",/' >> signer/fourbyte/autonity_4byte.json
LAST_LINE=$(cat signer/fourbyte/autonity_4byte.json | wc -l)
sed -i "$LAST_LINE s/,$//" signer/fourbyte/autonity_4byte.json
echo "}" >> signer/fourbyte/autonity_4byte.json
cat signer/fourbyte/4byte.json signer/fourbyte/autonity_4byte.json | jq -s add > signer/fourbyte/4byte_merged.json
mv signer/fourbyte/4byte_merged.json signer/fourbyte/4byte.json
rm signer/fourbyte/autonity_4byte.json
7 changes: 4 additions & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ package utils
import (
"crypto/ecdsa"
"fmt"
"github.com/autonity/autonity/eth/ethconfig"
"github.com/autonity/autonity/eth/tracers"
"io"
"io/ioutil"
"math"
Expand All @@ -35,6 +33,9 @@ import (
"text/template"
"time"

"github.com/autonity/autonity/eth/ethconfig"
"github.com/autonity/autonity/eth/tracers"

"github.com/autonity/autonity/accounts"
"github.com/autonity/autonity/accounts/keystore"
"github.com/autonity/autonity/common"
Expand Down Expand Up @@ -459,7 +460,7 @@ var (
}
RPCGlobalTxFeeCapFlag = cli.Float64Flag{
Name: "rpc.txfeecap",
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
Usage: "Sets a cap on transaction fee (in auton) that can be sent via the RPC APIs (0 = no cap)",
Value: ethconfig.Defaults.RPCTxFeeCap,
}
// Logging and debug settings
Expand Down
146,888 changes: 146,885 additions & 3 deletions signer/fourbyte/4byte.go

Large diffs are not rendered by default.

146,883 changes: 146,882 additions & 1 deletion signer/fourbyte/4byte.json

Large diffs are not rendered by default.

0 comments on commit 5ecab93

Please sign in to comment.