Skip to content

Commit 8bbdfd7

Browse files
authored
Merge branch 'ethereum:master' into gethintegration
2 parents 9fe2530 + 22c0605 commit 8bbdfd7

File tree

8 files changed

+48
-13
lines changed

8 files changed

+48
-13
lines changed

cmd/clef/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Clef
22

3-
Clef can be used to sign transactions and data and is meant as a(n eventual) replacement for Geth's account management. This allows DApps to not depend on Geth's account management. When a DApp wants to sign data (or a transaction), it can send the content to Clef, which will then provide the user with context and asks for permission to sign the content. If the users grants the signing request, Clef will send the signature back to the DApp.
3+
Clef can be used to sign transactions and data and is meant as a(n eventual) replacement for Geth's account management. This allows DApps to not depend on Geth's account management. When a DApp wants to sign data (or a transaction), it can send the content to Clef, which will then provide the user with context and ask for permission to sign the content. If the user grants the signing request, Clef will send the signature back to the DApp.
44

55
This setup allows a DApp to connect to a remote Ethereum node and send transactions that are locally signed. This can help in situations when a DApp is connected to an untrusted remote Ethereum node, because a local one is not available, not synchronized with the chain, or is a node that has no built-in (or limited) account management.
66

@@ -123,7 +123,7 @@ The External API is **untrusted**: it does not accept credentials, nor does it e
123123

124124
Clef has one native console-based UI, for operation without any standalone tools. However, there is also an API to communicate with an external UI. To enable that UI, the signer needs to be executed with the `--stdio-ui` option, which allocates `stdin` / `stdout` for the UI API.
125125

126-
An example (insecure) proof-of-concept of has been implemented in `pythonsigner.py`.
126+
An example (insecure) proof-of-concept has been implemented in `pythonsigner.py`.
127127

128128
The model is as follows:
129129

@@ -335,7 +335,7 @@ Bash example:
335335

336336
#### Arguments
337337
- content type [string]: type of signed data
338-
- `text/validator`: hex data with custom validator defined in a contract
338+
- `text/validator`: hex data with a custom validator defined in a contract
339339
- `application/clique`: [clique](https://github.com/ethereum/EIPs/issues/225) headers
340340
- `text/plain`: simple hex data validated by `account_ecRecover`
341341
- account [address]: account to sign with

cmd/clef/rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The `signer` binary contains a ruleset engine, implemented with [OttoVM](https://github.com/robertkrimen/otto)
44

5-
It enables usecases like the following:
5+
It enables use cases like the following:
66

77
* I want to auto-approve transactions with contract `CasinoDapp`, with up to `0.05 ether` in value to maximum `1 ether` per 24h period
88
* I want to auto-approve transaction to contract `EthAlarmClock` with `data`=`0xdeadbeef`, if `value=0`, `gas < 44k` and `gasPrice < 40Gwei`

cmd/evm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ which can
1616
1. Take a prestate, including
1717
- Accounts,
1818
- Block context information,
19-
- Previous blockshashes (*optional)
19+
- Previous block hashes (*optional)
2020
2. Apply a set of transactions,
2121
3. Apply a mining-reward (*optional),
2222
4. And generate a post-state, including

cmd/evm/eest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import "regexp"
2222
// within its filename by the execution spec test (EEST).
2323
type testMetadata struct {
2424
fork string
25-
module string // which python module gnerated the test, e.g. eip7702
25+
module string // which python module generated the test, e.g. eip7702
2626
file string // exact file the test came from, e.g. test_gas.py
2727
function string // func that created the test, e.g. test_valid_mcopy_operations
2828
parameters string // the name of the parameters which were used to fill the test, e.g. zero_inputs

eth/downloader/skeleton.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (s *skeleton) startup() {
275275
for {
276276
// If the sync cycle terminated or was terminated, propagate up when
277277
// higher layers request termination. There's no fancy explicit error
278-
// signalling as the sync loop should never terminate (TM).
278+
// signaling as the sync loop should never terminate (TM).
279279
newhead, err := s.sync(head)
280280
switch {
281281
case err == errSyncLinked:

eth/protocols/eth/handler_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,34 @@ func testGetBlockHeaders(t *testing.T, protocol uint) {
297297
backend.chain.GetBlockByNumber(0).Hash(),
298298
},
299299
},
300+
// Check a corner case where skipping causes overflow with reverse=false
301+
{
302+
&GetBlockHeadersRequest{Origin: HashOrNumber{Number: 1}, Amount: 2, Reverse: false, Skip: math.MaxUint64 - 1},
303+
[]common.Hash{
304+
backend.chain.GetBlockByNumber(1).Hash(),
305+
},
306+
},
307+
// Check a corner case where skipping causes overflow with reverse=true
308+
{
309+
&GetBlockHeadersRequest{Origin: HashOrNumber{Number: 1}, Amount: 2, Reverse: true, Skip: math.MaxUint64 - 1},
310+
[]common.Hash{
311+
backend.chain.GetBlockByNumber(1).Hash(),
312+
},
313+
},
314+
// Check another corner case where skipping causes overflow with reverse=false
315+
{
316+
&GetBlockHeadersRequest{Origin: HashOrNumber{Number: 1}, Amount: 2, Reverse: false, Skip: math.MaxUint64},
317+
[]common.Hash{
318+
backend.chain.GetBlockByNumber(1).Hash(),
319+
},
320+
},
321+
// Check another corner case where skipping causes overflow with reverse=true
322+
{
323+
&GetBlockHeadersRequest{Origin: HashOrNumber{Number: 1}, Amount: 2, Reverse: true, Skip: math.MaxUint64},
324+
[]common.Hash{
325+
backend.chain.GetBlockByNumber(1).Hash(),
326+
},
327+
},
300328
// Check a corner case where skipping overflow loops back into the chain start
301329
{
302330
&GetBlockHeadersRequest{Origin: HashOrNumber{Hash: backend.chain.GetBlockByNumber(3).Hash()}, Amount: 2, Reverse: false, Skip: math.MaxUint64 - 1},

eth/protocols/eth/handlers.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,22 @@ func serviceNonContiguousBlockHeaderQuery(chain *core.BlockChain, query *GetBloc
128128
}
129129
case query.Reverse:
130130
// Number based traversal towards the genesis block
131-
if query.Origin.Number >= query.Skip+1 {
132-
query.Origin.Number -= query.Skip + 1
133-
} else {
131+
current := query.Origin.Number
132+
ancestor := current - (query.Skip + 1)
133+
if ancestor >= current { // check for underflow
134134
unknown = true
135+
} else {
136+
query.Origin.Number = ancestor
135137
}
136138

137139
case !query.Reverse:
138-
// Number based traversal towards the leaf block
139-
query.Origin.Number += query.Skip + 1
140+
current := query.Origin.Number
141+
next := current + query.Skip + 1
142+
if next <= current { // check for overflow
143+
unknown = true
144+
} else {
145+
query.Origin.Number = next
146+
}
140147
}
141148
}
142149
return headers

internal/guide/guide_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

1717
// This file contains the code snippets from the developer's guide embedded into
18-
// Go tests. This ensures that any code published in out guides will not break
18+
// Go tests. This ensures that any code published in our guides will not break
1919
// accidentally via some code update. If some API changes nonetheless that needs
2020
// modifying this file, please port any modification over into the developer's
2121
// guide wiki pages too!

0 commit comments

Comments
 (0)