Skip to content
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

Connecting ethereum.js and go-ethereum -- MagicToken mismatch? #276

Closed
tinybike opened this issue Jan 27, 2015 · 6 comments
Closed

Connecting ethereum.js and go-ethereum -- MagicToken mismatch? #276

tinybike opened this issue Jan 27, 2015 · 6 comments

Comments

@tinybike
Copy link
Member

(I'm cross-posting this to ethereum.js, since it seems to pertain to both, from my limited vantage point.)

I've been tinkering with the JS API, trying to figure out how to compile contracts (and actually load them into the blockchain). The example here is using Serpent code, but I get the same error when using Solidity instead.

I'm running go-ethereum, started as ethereum -rpc -loglevel=4 -y. If I define a variable w/ some simple serpent code:

var serp = "def double(v):\n" +
"   return(v*2)"

Then from my browser (Chrome) console:

> web3.eth.serpent(serp)
Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

But, it just stays in "pending" forever. On the backend, I get the following message:

2015/01/26 23:48:58 [PEER] MagicToken mismatch. Received [80 79 83 84]

I'm not clear what this means -- what is a MagicToken? I googled and found https://gogs.io/github.com/eris-ltd/go-ethereum/wire, which says:

var MagicToken = []byte{34, 64, 8, 145}

"The magic token which should be the first 4 bytes of every message and can be used as separator between messages." I tried using this in Solidity:

var source = "[]byte{34, 64, 8, 145};" + 
"contract test {\n" +
"   function multiply(uint a) returns(uint d) {\n" +
"       return a * 7;\n" +
"   }\n" +
"}\n";
web3.eth.solidity(source);

but I get the same MagicToken error. What am I doing wrong?

@obscuren
Copy link
Contributor

The current version of go-ethereum's JSON RPC is using TCP/IP and will therefor not work in your browser. We're currently converting the RPC to HTTP and should probably be ready by the end of the week (will update this issue).

It also appears you're using a very old version of ethereum. Please update to develop branch

@tinybike
Copy link
Member Author

Got it. Can a browser talk to go-ethereum via websockets? (Was avoiding websockets since as I understand it they're not yet supported in cpp-ethereum, but...)

@obscuren
Copy link
Contributor

Yes it's supported -ws. Please be aware that web sockets support might drop. We're in the processes of changing to a fully synchronous JavaScript API rather than asynchronous

@tinybike
Copy link
Member Author

Hm, looks like ethereum.js's latest version no longer has providers.WebSocketProvider...strange.

@scottzer0
Copy link

yea, so as i understand it, ethereum.js has dropped websocket support in favor of http sync and go-ethereum has yet to implement http?

i'm chomping at the bit to start UI dev on our project...

@obscuren
Copy link
Contributor

@scottzer0 We've HTTP, it's not yet merged and doesn't support all calls.

jwasinger pushed a commit to jwasinger/go-ethereum that referenced this issue Apr 4, 2018
…e-snapshot-test

Swarm network rewrite snapshot test
AusIV pushed a commit to NoteGio/go-ethereum that referenced this issue Feb 22, 2021
…reum#276)

* main: adds flag use audit checks and refactors logic

-ethstats and -bootnodes and -network flags
were not being checked for exclusivity with -attach.
Adding those checks, this also refactors the auditor
function.

Date: 2021-01-05 07:02:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* main: remove ethPort vs. attach flag exclusive check

The ethPort default value is nonzero, making
this check incorrect.

Resolves etclabscore/core-geth#276 (comment)

Date: 2021-01-08 06:18:43-06:00
Signed-off-by: meows <b5c6@protonmail.com>
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Aug 13, 2021
…oEstimateGas from geth (ethereum#276)

* fix: add nil check when estimating gas to avoid panic during contract creation

* fix: revert DoEstimateGas changes introduced as a temp fix in ethereum#22

* Tweak fudge factor for Geth gas estimation (ethereum#292)

* experimenting with gas fudge factor

* fix formatting

* try using 1m gas constant

* Add log statement for the gas estimate

* Add more detail to gas estimate log

* one more log edit

* Try new formula

* Bump base gas

* Even more base gas

* even more

* Just 1m?

* one more time

* Final cleanup

* Minor fix

* Update internal/ethapi/api.go

* don't use cap-1

* Make sure data is not nil

Co-authored-by: Karl Floersch <karl@karlfloersch.com>

Co-authored-by: Ben Jones <ben@pseudonym.party>
Co-authored-by: smartcontracts <kelvinfichter@gmail.com>
Co-authored-by: Karl Floersch <karl@karlfloersch.com>
tanishqjasoria pushed a commit to tanishqjasoria/go-ethereum that referenced this issue Oct 31, 2023
* add l1 config in genesis config (ethereum#249)

* add l1 config in genesis config

* fix lint

* Update params/config.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

---------

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* extend node configuration (ethereum#251)

* extend node configuration

* use block number instead of hash

* accept safe, finalized and numbers for L1Confirmations

* fix typos

---------

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* Fix/improve node config parsing (ethereum#260)

* raise error on failed parsing

* default value

* add l1-message-type, transaction methods (ethereum#252)

* add l1-message-type, transaction methods

* goimports

* Update core/types/transaction.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* txpool l1 check, pointer change, marhsal test

* draft: start implementing l1message gas behavior

* draft: start implementing l1message gas behavior

* change to gas usage

* error comment typo

Co-authored-by: Haichen Shen <shenhaichen@gmail.com>

* goimports

* update nonce, add hash test (fails), marshal test

* goimports

* target addr cant be nil

* change call msg

* comment out test

* lint

---------

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>

* Add L1 message database (ethereum#255)

* add l1-message-type, transaction methods

* goimports

* Update core/types/transaction.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* add L1 message store to rawdb

* remove comments

* rename to l1_message

* rename variables and add comments

* write l1 msgs in a batch

* add more comments

* update tests

* allow batched and non-batched writes

* rename to accessors_l1_message

* handle error

* add range check

* fix tests

* update comments

* nit

* support blocks with 0 l1 messages

---------

Co-authored-by: Max Wolff <maxcwolff@gmail.com>
Co-authored-by: Max Wolff <max@scroll.io>

* Fix L1Message Deep Copy, Complete Bridge Tx Hash test (ethereum#269)

* deep copy value field, add tx hash test

comment

* typo

* Rename nonce to queueindex, increment sender nonce on L1 message execution (ethereum#271)

* change nonce to queueindex, increment nonce on L1 message

* fix db acccessors

* Update core/types/transaction_marshalling.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

---------

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* Fix db inspect command (ethereum#276)

fix db inspect command

* Add l1 sync service (ethereum#256)

* extend node configuration

* add l1-message-type, transaction methods

* goimports

* Update core/types/transaction.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* use block number instead of hash

* accept safe, finalized and numbers for L1Confirmations

* add L1 message store to rawdb

* remove comments

* fix typos

* add L1 message sync service

* use l1 contract address and chain ID

* use L1DeploymentBlock

* add confirmation config

* move bridge client to separate file

* use uint64 block number

* fix bigint comparison

* rename constants

* add more logs

* rename to l1_message

* rename variables and add comments

* write l1 msgs in a batch

* add more comments

* update tests

* allow batched and non-batched writes

* rename to accessors_l1_message

* handle error

* check if config is provided

* improve sync service DB batched writes

* add range check

* fix tests

* update comments

* nit

* fix flush range and improve comments

* solve circular dependency

* update stress tests

* initialize l1 client for geth

* start sync service

* add more comments

* check nil correctly

* address comments

* fix merge

* fix genesis l1config deserialization

* add sync progress logs

* initial sync

* handle leveldb not found error

* use errors.Is

* address comments

* update DefaultPollInterval

---------

Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com>
Co-authored-by: Max Wolff <maxcwolff@gmail.com>
Co-authored-by: Max Wolff <max@scroll.io>

* Add L1 message validation (ethereum#272)

* add L1 message validation

* add comments and better error handling

* handle leveldb not found error

* update incorrect condition for genesis block

* typo

* change inclusion index logic

* disable L1 message check for legacy tests

* set NumL1MessagesPerBlock to 0 in tests

* update default genesis config

* Add L1 msg validation tests (ethereum#303)

add L1 msg validation tests

* Update miner include l1 messages (ethereum#265)

* add l1-message-type, transaction methods

* goimports

* Update core/types/transaction.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* add L1 message store to rawdb

* add L1 message sync service

* remove comments

* use l1 contract address and chain ID

* extend node configuration

* use block number instead of hash

* accept safe, finalized and numbers for L1Confirmations

* fix typos

* use L1DeploymentBlock

* add confirmation config

* move bridge client to separate file

* use uint64 block number

* fix bigint comparison

* rename constants

* add more logs

* Fix/improve node config parsing (ethereum#260)

* raise error on failed parsing

* default value

* rename to l1_message

* rename variables and add comments

* write l1 msgs in a batch

* add more comments

* update tests

* allow batched and non-batched writes

* rename to accessors_l1_message

* handle error

* check if config is provided

* improve sync service DB batched writes

* include l1 messages in blocks: part 1

* add l1-message-type, transaction methods (ethereum#252)

* add l1-message-type, transaction methods

* goimports

* Update core/types/transaction.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* txpool l1 check, pointer change, marhsal test

* draft: start implementing l1message gas behavior

* draft: start implementing l1message gas behavior

* change to gas usage

* error comment typo

Co-authored-by: Haichen Shen <shenhaichen@gmail.com>

* goimports

* update nonce, add hash test (fails), marshal test

* goimports

* target addr cant be nil

* change call msg

* comment out test

* lint

---------

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>

* Add L1 message database (ethereum#255)

* add l1-message-type, transaction methods

* goimports

* Update core/types/transaction.go

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* add L1 message store to rawdb

* remove comments

* rename to l1_message

* rename variables and add comments

* write l1 msgs in a batch

* add more comments

* update tests

* allow batched and non-batched writes

* rename to accessors_l1_message

* handle error

* add range check

* fix tests

* update comments

* nit

* support blocks with 0 l1 messages

---------

Co-authored-by: Max Wolff <maxcwolff@gmail.com>
Co-authored-by: Max Wolff <max@scroll.io>

* build(docker): auto docker push when pushing git tags (ethereum#258)

* build(docker): update docker trigger tag prefix (ethereum#259)

* Fix L1Message Deep Copy, Complete Bridge Tx Hash test (ethereum#269)

* deep copy value field, add tx hash test

comment

* typo

* commitl1messages

* lint

* Revert "add L1 message sync service"

This reverts commit 5305e8a.

* Revert "move bridge client to separate file"

This reverts commit 0b220be.

* update branch

* use commitMessages for l1Txs

* little fix

* fix config

* fix test

* comment fixes

* fix

* fix config check

---------

Co-authored-by: Max Wolff <maxcwolff@gmail.com>
Co-authored-by: Max Wolff <max@scroll.io>
Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>

* Add ErrUnknownAncestor tests (ethereum#305)

add ErrUnknownAncestor tests

* worker test include l1 msgs (ethereum#306)

* worker test include l1 msgs

* move L1 message index update next to block insertion

---------

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* exclude l1 messages from transaction count limit in block (ethereum#307)

* exclude l1 messages from transaction count limit in block

* fix comments

* trigger ci

* nit

---------

Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* Expose queueIndex on Transaction (ethereum#316)

expose queueIndex on Transaction

* test that l1msg doesn't count in maxTxPerBlock limit (ethereum#312)

* test that l1msg doesn't count in maxTxPerBlock limit

* fix, comment

* retrigger ci

* change order inside test

---------

Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <th307q@gmail.com>

* reuse trace nonce field for queueIndex

* expose scroll APIs on the geth console

* add L1 message query APIs

* Trigger new block on new l1 messages (ethereum#343)

* trigger new block on new l1 messages

* typo

* initialize l1MsgCh

* fix worker l1msg tests (ethereum#345)

---------

Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com>

* test(worker): ensure that l1 messages are included in the correct order (ethereum#346)

test that l1msgs added in correct order

* rename enqueueIndex --> queueIndex

* move QueueIndex into transaction

* improve l1 db interface

* formatting

* bump version

* print l1config

* add API to query latest included message queue index

* clean up tx limit logic

* add clarifying comments and todos to ValidateL1Messages

* improve db comments and logs

* clean up L1MessageTx type handling

* format

* format

* improve L1 message block check

* fix missing L1 event handling

* fix TestL1MessageValidationFailure

* simplify sync height resume logic

* make l1Config.l1MessageQueueAddress non-pointer

* improve command line flags

* remove todo

* use abigen tools for log filtering

* cache block L1 message count

* nit: fix variable name case

* improve logs

* flush pending writes to DB before shutdown

---------

Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com>
Co-authored-by: Max Wolff <max@scroll.io>
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>
Co-authored-by: Max Wolff <maxcwolff@gmail.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
Co-authored-by: HAOYUatHZ <haoyu@protonmail.com>
sduchesneau pushed a commit to streamingfast/go-ethereum that referenced this issue Jan 4, 2024
…address-not-available

fix prunning: use correct state root and don't require account address
billettc pushed a commit to streamingfast/go-ethereum that referenced this issue May 13, 2024
Remove usage of depreciated values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants