-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: method for eip-1271 #80
Conversation
paging @w4ll3 - could you please take a look if this would make sense for you? c = Contract.create(file: "spec/fixtures/contracts/signer.sol", contract_index: 1)
# => #<Eth::Contract::Signer:0x0000556cd236ff30>
g = Eth::Client.create "/tmp/geth.ipc"
# => #<Eth::Client::Ipc:0x0000556cd23c34a0 @gas_limit=21000, @id=0, @max_fee_per_gas=0.2e11, @max_priority_fee_per_gas=0, @path="/tmp/geth.ipc">
m = "I am authentic!"
# => "I am authentic!"
p = Signature.prefix_message m
# => "\u0019Ethereum Signed Message:\n15I am authentic!"
h = Util.keccak256 p
# => "p\xFB\xC5w\xC8\xE0zo\xD0!r%\xD8\x7Fc\x8B~\xD2n/R\x12\x93\x1DI\xD3$\xDA\a\xF3\x1D\xF2"
s = Util.hex_to_bin "2166d149f4cddd5cf0e8f165366322a3fce0d05e82269371477199f12160c72c0de17dea759a80e# 2c40334903a2ec5b7d53ba47e0eb9d8dd996a921e811a58a61c"
=> "!f\xD1I\xF4\xCD\xDD\\\xF0\xE8\xF1e6c\"\xA3\xFC\xE0\xD0^\x82&\x93qGq\x99\xF1!`\xC7,\r\xE1}\xEAu\x9A\x80\xE2\xC4\x034\x90:.\xC5\xB7\xD5;\xA4~\x0E\xB9\xD8\xDD\x99j\x92\x1E\x81\x1AX\xA6\x1C"
_ = g.deploy_and_wait(c)
# => "0x967ce372d0f30ba9d466d1b047b0362f82e29ab9"
g.is_valid_signature c, h, s
# => true |
Codecov Report
@@ Coverage Diff @@
## main #80 +/- ##
=======================================
Coverage 99.73% 99.73%
=======================================
Files 67 67
Lines 3754 3780 +26
=======================================
+ Hits 3744 3770 +26
Misses 10 10
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great !
* spec: add signer contract for eip-1271 * eth/client: implement is_valid_signature * eth/client: document is_valid_signature * docs: update readme
closes #44