Skip to content

Commit

Permalink
Merge branch 'master' into hbandura/fix_st
Browse files Browse the repository at this point in the history
  • Loading branch information
piersy authored May 15, 2024
2 parents 5289d6d + ca3465c commit 9964a50
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/add-docker-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
run: |
curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 > regctl
chmod 755 regctl
sudo mv regctl /usr/local/sbin
- name: Use regctl to copy images (add tags)
run: |
Expand Down
2 changes: 1 addition & 1 deletion consensus/istanbul/backend/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func (sb *Backend) checkIsValidSigner(chain consensus.ChainHeaderReader, header
}

// Seal generates a new block for the given input block with the local miner's
// seal place on top and submits it the the consensus engine.
// seal place on top and submits it the consensus engine.
func (sb *Backend) Seal(chain consensus.ChainHeaderReader, block *types.Block) error {

header := block.Header()
Expand Down
2 changes: 1 addition & 1 deletion consensus/istanbul/backend/message_senders.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (sb *Backend) Gossip(payload []byte, ethMsgCode uint64) error {
return sb.asyncMulticast(peersToSendMsg, payload, ethMsgCode)
}

// sendMsg will asynchronously send the the Celo messages to all the peers in the destPeers param.
// sendMsg will asynchronously send the Celo messages to all the peers in the destPeers param.
func (sb *Backend) asyncMulticast(destPeers map[enode.ID]consensus.Peer, payload []byte, ethMsgCode uint64) error {
logger := sb.logger.New("func", "AsyncMulticastCeloMsg", "msgCode", ethMsgCode)
// Istanbul was encoding messages before sending it to the peer,
Expand Down
2 changes: 1 addition & 1 deletion consensus/istanbul/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func (c *core) startNewSequence() error {
if headBlock.Number().Cmp(c.current.Sequence()) == 0 {
logger.Trace("Moving to the next block")
} else if headBlock.Number().Cmp(c.current.Sequence()) > 0 {
logger.Trace("Catching up the the head block")
logger.Trace("Catching up the head block")
} else {
logger.Warn("New sequence should be larger than current sequence")
// TODO(Joshua): figure out if we need to wait for the next block to be mined here
Expand Down
2 changes: 1 addition & 1 deletion consensus/istanbul/proxy/proxy_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestProxySet(t *testing.T) {
expectedValProxyAssignments: map[common.Address]*Proxy{remoteVal0Address: proxy1, remoteVal1Address: proxy1, remoteVal2Address: proxy1},
},

// Test the the unpeered proxy getting repeered
// Test the unpeered proxy getting repeered
{
setProxyPeer: map[enode.ID]consensus.Peer{proxy0ID: proxy0Peer},
expectedValProxyAssignments: map[common.Address]*Proxy{remoteVal0Address: proxy0, remoteVal1Address: proxy1, remoteVal2Address: proxy0},
Expand Down
4 changes: 2 additions & 2 deletions core/state/snapshot/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ var (
// accountCheckRange is the upper limit of the number of accounts involved in
// each range check. This is a value estimated based on experience. If this
// value is too large, the failure rate of range prove will increase. Otherwise
// the the value is too small, the efficiency of the state recovery will decrease.
// the value is too small, the efficiency of the state recovery will decrease.
accountCheckRange = 128

// storageCheckRange is the upper limit of the number of storage slots involved
// in each range check. This is a value estimated based on experience. If this
// value is too large, the failure rate of range prove will increase. Otherwise
// the the value is too small, the efficiency of the state recovery will decrease.
// the value is too small, the efficiency of the state recovery will decrease.
storageCheckRange = 1024

// errMissingTrie is returned if the target trie is missing while the generation
Expand Down
2 changes: 1 addition & 1 deletion crypto/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Note:
- To avoid unnecessary loads and make use of available registers, two
'passes' have every time been interleaved, with the odd passes accumulating c' and d'
which will be added to c and d respectively in the the even passes
which will be added to c and d respectively in the even passes
*/

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/_whisper/Diagnostic-Tool-wnode.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,4 @@ Please enter the topic (hexadecimal):
```

You can leave the topic empty for now, in which case all the messages will be delivered, regardless of the topic.
The message should be delivered by the the Server, decrypted by the Client and displayed on the screen.
The message should be delivered by the Server, decrypted by the Client and displayed on the screen.
2 changes: 1 addition & 1 deletion eth/protocols/eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type Backend interface {

// TxPool defines the methods needed by the protocol handler to serve transactions.
type TxPool interface {
// Get retrieves the the transaction from the local txpool with the given hash.
// Get retrieves the transaction from the local txpool with the given hash.
Get(hash common.Hash) *types.Transaction
}

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ require (
github.com/aws/aws-sdk-go-v2/config v1.1.1
github.com/aws/aws-sdk-go-v2/credentials v1.1.1
github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1
github.com/btcsuite/btcd v0.23.2
github.com/btcsuite/btcd v0.24.0
github.com/btcsuite/btcd/btcec/v2 v2.1.3
github.com/btcsuite/btcd/btcutil v1.1.1
github.com/btcsuite/btcd/btcutil v1.1.5
github.com/buraksezer/consistent v0.0.0-20191006190839-693edf70fd72
github.com/celo-org/celo-bls-go v0.3.4
github.com/cespare/cp v0.1.0
Expand All @@ -29,7 +29,7 @@ require (
github.com/golang/snappy v0.0.4
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa
github.com/google/uuid v1.1.5
github.com/gorilla/websocket v1.4.2
github.com/gorilla/websocket v1.5.0
github.com/graph-gophers/graphql-go v1.3.0
github.com/hashicorp/go-bexpr v0.1.10
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
Expand Down Expand Up @@ -78,7 +78,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 // indirect
github.com/aws/smithy-go v1.1.0 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/celo-org/celo-bls-go-android v0.3.3 // indirect
github.com/celo-org/celo-bls-go-ios v0.3.3 // indirect
github.com/celo-org/celo-bls-go-linux v0.3.3 // indirect
Expand Down
11 changes: 11 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,24 @@ github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13P
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
github.com/btcsuite/btcd v0.23.2 h1:/YOgUp25sdCnP5ho6Hl3s0E438zlX+Kak7E6TgBgoT0=
github.com/btcsuite/btcd v0.23.2/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo=
github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4=
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
github.com/btcsuite/btcd/btcec/v2 v2.1.1/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJkgl+MTE=
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
github.com/btcsuite/btcd/btcutil v1.1.1 h1:hDcDaXiP0uEzR8Biqo2weECKqEw0uHDZ9ixIWevVQqY=
github.com/btcsuite/btcd/btcutil v1.1.1/go.mod h1:nbKlBMNm9FGsdvKvu0essceubPiAcI57pYBNnsLAa34=
github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8=
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
Expand Down Expand Up @@ -250,6 +259,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0=
github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE=
Expand Down
16 changes: 10 additions & 6 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1288,9 +1288,9 @@ type RPCTransaction struct {
GasPrice *hexutil.Big `json:"gasPrice"`
GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"`
GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
FeeCurrency *common.Address `json:"feeCurrency"`
GatewayFeeRecipient *common.Address `json:"gatewayFeeRecipient"`
GatewayFee *hexutil.Big `json:"gatewayFee"`
FeeCurrency *common.Address `json:"feeCurrency,omitempty"`
GatewayFeeRecipient *common.Address `json:"gatewayFeeRecipient,omitempty"`
GatewayFee *hexutil.Big `json:"gatewayFee,omitempty"`
Hash common.Hash `json:"hash"`
Input hexutil.Bytes `json:"input"`
Nonce hexutil.Uint64 `json:"nonce"`
Expand All @@ -1303,7 +1303,7 @@ type RPCTransaction struct {
V *hexutil.Big `json:"v"`
R *hexutil.Big `json:"r"`
S *hexutil.Big `json:"s"`
EthCompatible bool `json:"ethCompatible"`
EthCompatible *bool `json:"ethCompatible,omitempty"`
}

// newRPCTransaction returns a transaction that will serialize to the RPC
Expand Down Expand Up @@ -1341,7 +1341,11 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
V: (*hexutil.Big)(v),
R: (*hexutil.Big)(r),
S: (*hexutil.Big)(s),
EthCompatible: tx.EthCompatible(),
}
// Set eth compatible for legacy transactions only
if tx.Type() == types.LegacyTxType {
ec := tx.EthCompatible()
result.EthCompatible = &ec
}
if blockHash != (common.Hash{}) {
result.BlockHash = &blockHash
Expand Down Expand Up @@ -2135,7 +2139,7 @@ func generateReceiptResponse(ctx context.Context, backend Backend, receipt *type
fields["from"], _ = types.Sender(signer, tx)
fields["to"] = tx.To()
// Assign the effective gas price paid
if backend.ChainConfig().IsLondon(new(big.Int).SetUint64(blockNumber)) {
if !backend.ChainConfig().IsLondon(new(big.Int).SetUint64(blockNumber)) {
fields["effectiveGasPrice"] = hexutil.Uint64(tx.GasPrice().Uint64())
} else {
// var gasPrice *big.Int = new(big.Int)
Expand Down
42 changes: 42 additions & 0 deletions internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package ethapi

import (
"encoding/json"
"errors"
"fmt"
"math/big"
"testing"

"github.com/celo-org/celo-blockchain/common"
"github.com/celo-org/celo-blockchain/common/hexutil"
"github.com/celo-org/celo-blockchain/core/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

// TestNewRPCTransactionCeloDynamicV2 tests the newRPCTransaction method with a celo dynamic fee tx v2 type.
Expand Down Expand Up @@ -159,3 +162,42 @@ func TestNewRPCTransactionDynamic(t *testing.T) {
assert.Equal(t, (*hexutil.Big)(bigFeeCap), rpcTx.GasPrice)
})
}

// TestNewRPCTransactionEthCompatible tests that only legacy transactions have the eth compatbile field set.
func TestNewRPCTransactionEthCompatible(t *testing.T) {
blockHash := common.BigToHash(big.NewInt(123456))
blockNumber := uint64(123456)
index := uint64(7)
baseFeeFn := func(curr *common.Address) (*big.Int, error) {
return big.NewInt(600), nil
}

t.Run("LegacyTx ethCompatible", func(*testing.T) {
rpcTx := newRPCTransaction(types.NewTx(&types.LegacyTx{
EthCompatible: true,
}), blockHash, blockNumber, index, baseFeeFn, true)
assert.Equal(t, true, jsonRoundtripToMap(t, rpcTx)["ethCompatible"])
})

t.Run("LegacyTx not ethCompatible", func(*testing.T) {
rpcTx := newRPCTransaction(types.NewTx(&types.LegacyTx{
EthCompatible: false,
}), blockHash, blockNumber, index, baseFeeFn, true)
assert.Equal(t, false, jsonRoundtripToMap(t, rpcTx)["ethCompatible"])
})

t.Run("Non legacy tx ethCompatible not set", func(*testing.T) {
rpcTx := newRPCTransaction(types.NewTx(&types.DynamicFeeTx{}), blockHash, blockNumber, index, baseFeeFn, true)
assert.NotContains(t, jsonRoundtripToMap(t, rpcTx), "ethCompatible")
fmt.Printf("%+v\n", jsonRoundtripToMap(t, rpcTx))
})
}

func jsonRoundtripToMap(t *testing.T, tx *RPCTransaction) map[string]interface{} {
marshaled, err := json.Marshal(tx)
require.NoError(t, err)
m := make(map[string]interface{})
err = json.Unmarshal(marshaled, &m)
require.NoError(t, err)
return m
}
2 changes: 1 addition & 1 deletion les/vflux/client/serverpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (
queryWaitStep = 1.02 // exponential multiplier of redial wait time when no value was provided by the server
waitThreshold = time.Hour * 2000 // drop node if waiting time is over the threshold
nodeWeightMul = 1000000 // multiplier constant for node weight calculation
nodeWeightThreshold = 100 // minimum weight for keeping a node in the the known (valuable) set
nodeWeightThreshold = 100 // minimum weight for keeping a node in the known (valuable) set
minRedialWait = 10 // minimum redial wait time in seconds
preNegLimit = 5 // maximum number of simultaneous pre-negotiation queries
warnQueryFails = 20 // number of consecutive UDP query failures before we print a warning
Expand Down
2 changes: 1 addition & 1 deletion monorepo_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f08e269d88c6680641427952ce4743a7d26336a6
a63f0ec01ecd52b35dd01554eff22337e183da40
2 changes: 1 addition & 1 deletion p2p/discover/v5wire/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type (
ReqID []byte
ENRSeq uint64
ToIP net.IP // These fields should mirror the UDP envelope address of the ping
ToPort uint16 // packet, which provides a way to discover the the external address (after NAT).
ToPort uint16 // packet, which provides a way to discover the external address (after NAT).
}

// FINDNODE is a query for nodes in the given bucket.
Expand Down
2 changes: 1 addition & 1 deletion trie/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (it *nodeIterator) seek(prefix []byte) error {
}
}

// init initializes the the iterator.
// init initializes the iterator.
func (it *nodeIterator) init() (*nodeIteratorState, error) {
root := it.trie.Hash()
state := &nodeIteratorState{node: it.trie.root, index: -1}
Expand Down

0 comments on commit 9964a50

Please sign in to comment.