Comments (2)
This repository contains our implementation of an Ethereum Node Record (https://eips.ethereum.org/EIPS/eip-778).
Might be worth reading the specification to understand what is happening.
There are a few keys (in the spec) that are required. Like seq
signature
id
etc.
Our library as it stands, makes it possible for users to accidentally (or intentially) overwrite these fields with incorrect values making the ENR object invalid.
The library would be better if the mutating functions prevented users from erroneously modifying an ENR that could make it valid. This issue is to check all our mutating functions in the ENRBuilder and the ENR struct to make sure the spec-reserved keys cannot be mutated by the user to make the ENR invalid.
One example is:
The insert()
function: https://github.com/sigp/enr/blob/master/src/lib.rs#L457 which calls insert_raw_rlp():https://github.com/sigp/enr/blob/master/src/lib.rs#L470
I think a user is capable of setting invalid types for tcp
udp
ip
etc. It might error if we try to set the seq
or signature
here, but its worth checking.
It might be useful to write some tests to ensure changes prevent invalid ENRs.
We should also check other mutable functions to make sure users cannot create invalid enrs (according to the spec).
from enr.
One solution could be to create a const list of spec-reserved keys and prevent their mutation through generic functions like insert()
. This way if new spec keys are added its easy to maintain, as we simply add to this list.
from enr.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enr.