Skip to content

fix N being overwritten by BigInt.Div functionality #2

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

Closed
wants to merge 1 commit into from

Conversation

vessenes
Copy link

Div modifies the object that calls it as well as returns the result. N was being overwritten with the div result and eventually (quickly) went to zero.

I'm not super savvy to go, so there may be a more canonical way to do this, like e.g. calling dag.xn.Div, which didn't work for me. In this case, though, pow is not used again in the function and seemed safe to overwrite.

@obscuren
Copy link
Contributor

Thanks for your contribution but I have to reject your commit. You fixed something that had already been fixed in d895f83

I'm not sure if you are aware but ethereum is still in its very early development (code wise). Dagger is also subject to change (spec wise) so I wouldn't bother with it too much :)

@obscuren obscuren closed this Jan 10, 2014
@vessenes
Copy link
Author

No worries!

@zelig zelig mentioned this pull request Jan 5, 2015
obscuren added a commit that referenced this pull request Feb 13, 2015
…generation

Correct ECIES shared key length check
@frozeman frozeman mentioned this pull request Mar 12, 2015
Closed
@ghost ghost mentioned this pull request May 11, 2015
@ghost ghost mentioned this pull request Dec 13, 2015
@fluidvoice fluidvoice mentioned this pull request May 21, 2016
7 tasks
prestonvanloon pushed a commit to prestonvanloon/go-ethereum that referenced this pull request Jan 15, 2018
cdetrio pushed a commit to cdetrio/go-ethereum that referenced this pull request Feb 24, 2018
Latest changes from go-ethereum
MetadiumRelease referenced this pull request in METADIUM/go-metadium Jul 27, 2018
Master

Approved-by: Uh Sado <sadoc@metadium.com>
shiotoli pushed a commit to CortexFoundation/MinerInterface that referenced this pull request Aug 14, 2018
dindinw added a commit to dindinw/go-ethereum that referenced this pull request Dec 12, 2021
eth/tracers: fix go-duktape warning
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this pull request Jan 20, 2022
* Expose mobile http server

* Must set vhosts

* Add package.json

* Try postinstall

* I am silly

* Add .aar to package

* don't make on install

* Switched to new mobile mining app.

* Fixed a bug.

* Cleaned up some code and added comments.

* Added todo and reformatted.

* Small changes.

* Expose personal

* add ipc

* new version

* remove comments

* new build
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this pull request Jan 20, 2022
When paying gas fees in C$ or any other non-native currency

1. Charge the user upfront for three things
   - balanceOf - to determine their balance in that currency)
   - debitFrom - to debit gas from their account
   - creditTo - to credit miner at the end

2. At the end if the fee to be refunded is less than the transaction fee
to refund then pass that fee to the miner.

Prior to this diff, ethereum#1 was not happening properly and ethereum#2 was not
happening at all.

As a more concrete example, if user passes 100K C$ wei as gas amount
for a send tranaction then we will deduct 2195 to determine their
balance in C$, then we will deduct 10,000 for a debitFrom transaction
and another 10K for a creditTo transaction.
So, the available gas (`st.gas`) would be
100,000 - 22,195 = 77,805 for rest of the transaction.

At the end, we will pay the gas fees to the miner, which in this case is
22,195 + 21,000 (send fee) = 43,195, at the end, 56,805 gas is left, out
of which 10, 000 is further deducted and then 46,805 is refunded to the
sender and 43, 195 + 10, 000 is sent to the miner.

Sample logs with gas price = 999
```
DEBUG[03-21|18:18:51.003|core/state_transition.go:252]           debitGas                                 amount=99900000 gasCurrency=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4
TRACE[03-21|18:18:51.003|core/state_transition.go:262]           debitGas                                 rootCaller=0 customTokenContractAddress=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4 gas=10000 value=0 transactionData=0x362a5f80000000000000000000000000fee1a22f43beecb912b5a4912ba87527682ef0fc0000000000000000000000000000000000000000000000000000000005f45a60
DEBUG[03-21|18:18:51.003|core/state_transition.go:273]           debitGas successful                      ret=0x00000000000000000000000000000000000000000000006c4fd1ee2454c9dd59 leftoverGas=2351
TRACE[03-21|18:18:51.003|core/state_transition.go:192]           buyGas after debitGas                    upfrontGasCharges=22195 available gas=77805   initial gas=100000  gasCurrency=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4
TRACE[03-21|18:18:51.003|core/state_transition.go:463]           Refunding gas to sender                  sender=0xfeE1a22F43BeeCB912B5a4912ba87527682ef0fC refundAmount=46758195 gas Currency=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4
DEBUG[03-21|18:18:51.003|core/state_transition.go:252]           creditGas                                amount=46758195 gasCurrency=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4
TRACE[03-21|18:18:51.003|core/state_transition.go:262]           creditGas                                rootCaller=0 customTokenContractAddress=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4 gas=10000 value=0 transactionData=0x9951b90c000000000000000000000000fee1a22f43beecb912b5a4912ba87527682ef0fc0000000000000000000000000000000000000000000000000000000002c97933
DEBUG[03-21|18:18:51.004|core/state_transition.go:273]           creditGas successful                     ret=0x00000000000000000000000000000000000000000000006c4fd1ee245793568c leftoverGas=2057
TRACE[03-21|18:18:51.004|core/state_transition.go:425]           Paying gas fees to miner                 unrefundedGas=0 gas used=53195 gasFeesForMiner=53195 miner Fee=53141805
TRACE[03-21|18:18:51.004|core/state_transition.go:428]           Paying gas fees to miner                 miner=0xfeE1a22F43BeeCB912B5a4912ba87527682ef0fC minerFee=53141805 gas Currency=0x13f252CFCd0AED2FBAdAE507AA812aa1De01d8a4
```
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this pull request Jan 20, 2022
* Make tx pool fee check logic match the logic in state_transition.go

* Improve non-native currency fee tx handling (ethereum#2)

Improves multi-currency fee support in the tx pool queue and pending lists.
Previously when paying for a tx in a non-native currency, the balance of the account
would only be checked when inserting the transaction into the tx pool, but as the
balance of the account can change after the tx is admitted, transactions are periodically
checked for validity in `txList.Filter`. This PR changes txList to properly track balances in
non-native currencies. This also adds support for checking the gas price minimum in the txList.

This PR also converts gas prices to CELO prior to comparing if a new transaction at the same
nonce should override an old transaction at the same nonce. It also refactors calculations
of `tx.Fee()`

* Fix nil pointer exception in txList Filter

This occurred because gasPriceMinimums contains the gasPriceMinimum for
every fee currency, not just the fee currencies of the transfer. This
changes the iteration to go through each gasPriceFloor and then get the
gasPriceMinimum from the fee currency associated with the floor. This works
because gasPriceMinimums contains every whitelisted fee currency and the tx
has already been validated to pay in a fee currency.

* Fix panic in 'ConvertToGold()'

Co-authored-by: Joshua Gutow <joshua@celo.org>
Co-authored-by: Joshua Gutow <joshua@clabs.co>
asn-d6 referenced this pull request in asn-d6/go-ethereum Feb 20, 2022
Implement `DATAHASH` opcode and sharding fork
Inphi pushed a commit to Inphi/go-ethereum that referenced this pull request Jun 14, 2022
@schonex schonex mentioned this pull request Sep 19, 2022
joshuacolvin0 pushed a commit to joshuacolvin0/go-ethereum that referenced this pull request Jan 4, 2023
neraty pushed a commit to gnosis/go-ethereum that referenced this pull request Mar 13, 2023
neraty pushed a commit to gnosis/go-ethereum that referenced this pull request Apr 3, 2023
sbellem pushed a commit to sbellem/go-ethereum that referenced this pull request Jul 25, 2023
This commit introduces the ciphertext registry, with its three main
components:
 * protected storage space for persistent registry entries
 * ciphertext handles
 * in-memory ciphertext registry that persist for the lifetime of the
   transaction/call

The protected storage space is implemented as a separate contract,
linked to the actual one. When we create a contract, we take its address
and run it through SHA256 to get the address of the corresponding
protected storage contract. See more in evm.go, Create().

A ciphertext handle is the SHA256 hash of a ciphertext. It is generated
by the call to the `verifyCiphertext()` precompiled contract.
If a handle is stored in contract storage, we persist the actual
ciphertext in protected storage, along with some metadata. One piece of
metadata is the reference count. In essense, if a handle is stored in
contract storage via SSTORE, the refcount is bumped by 1. If a handle is
overwritten, the refcount is reduced by 1. Additionally, we
automatically verify any handle that points to a ciphertext on SLOAD.

Verifying a ciphertext essentially means storing it in an in-memory map
from hash(ciphertext) => {ciphertext, verified_at_stack_depth}. A
ciphertext is verified only for a particular stack depth and further on.
On the RETURN opcode, we remove entries from the map that are no longer
verified. More information to follow on that approach.

More features and code cleanup will be added in future commits.
spencer-tb pushed a commit to spencer-tb/go-ethereum that referenced this pull request Aug 4, 2023
core/vm/contracts: Fix beacon root pre-compile address by adding it to cancun contracts
nikicat pushed a commit to nikicat/go-ethereum that referenced this pull request Sep 11, 2023
zksync fix V value in ValidateSignatureValues
cuiweixie pushed a commit to cuiweixie/go-ethereum that referenced this pull request Nov 2, 2023
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Freddy Caceres <facs95@gmail.com>
allnil pushed a commit to allnil/go-ethereum that referenced this pull request Feb 24, 2024
* add description to ReadMe

* typo
atenjin referenced this pull request in alt-research/go-ethereum Apr 4, 2024
This commit squashes the op-geth fork history into a more maintainable
diff for rebasing upon upstream geth.

reference-optimistic-geth changes (origins of op-geth in early Bedrock
development stage):
- Deposit TX Type
- Enable deposit tx in EVM/tx pool
- Change deposit nonce to not be the max nonce
- Extend PayloadAttributesV1 with a Transactions field
- Force deposits at the start of each L2 block
- Fix height check
- noTxPool flag, reproduce block in verifier mode without tx pool interference
- Fix RPC json marshalling (ref op-geth PR 4)
- Deposit txs block height check in block body validation (ref op-geth PR 5)
- core: do not try to reinject deposit txs into tx-pool (ref-op-geth PR 6)
- deposit source hash field instead of L2 block height and tx index combination
- Include invalid deposits, rewind state, but always persist mint (ethereum#10)
- Provide gas to Call/Create in deposit transactions (ethereum#12)
- Add docker builds (ref-op-geth PR 16, 17)
- Don't panic on deposit transaction signature values or chain ID (ref-op-geth PR 18)
- core: Add version to DepositTx (ref-op-geth PR 19)
- Enable Geth build/lint/test in CircleCI (ref-op-geth PR 23)
- core: Include guaranteed gas in the gas pool (ref-op-geth PR 21)
- core: handle base fee, l1 availability fee, tx fee (ref-op-geth PR 27)
- fix: deposit tx hash
- fix l1 fee cache, rpc, tracing and tx pool
- core: remove deposit-tx sub-type (a.k.a. deposit version byte)
- eth/catalyst: allow engine user to reorg own chain
- miner: restore ability to reorg deep as block builder
- params: print Optimism consensus type in banner
- core/types: remove unused protected() method, see upstream PR 23376
- core: do not mutate original balance value in tx pool l1 cost adjustment
- core: subtract deposit gas from pool, so other txs do not use the same gas. And fail tx processing if deposits reach gas limit
- core/types: deposits do not tip, avoid basefee subtraction
- Unmeter the L1 Attributes Transaction
- miner: handle force tx errors as critical, clean up diff
- ci: Switch branch
- eth,miner: return STATUS_INVALID when failing to process forced transactions in request (ref-op-geth PR 40)
- verifier: forward tx to sequencer based on flag
- txpool: add flag to disable tx gossip (ref-op-geth PR 42)
- Add op-geth version in addition to geth version (ref-op-geth PR 43)
- ci: CircleCI improvements (ref-op-geth PR 44)
- Rename to op-geth
- Build latest tag on optimism branch

op-geth changes:
- Expose cache config in simulated backend (#2)
- Add EIP-1559 parameters
- eth/catalyst: update payload id computation (#1)
- make eip1559 configurable (ethereum#4)
- post-merge network should not log warnings about missing transition information (ethereum#5)
- Make the simulator more configurable (ethereum#6)
- fix OPB-6 - IsDepositTx check instead of artificial nonce value check (ethereum#7)
- Simulated backend - enable proof of stake consensus type and fix performance issue (ethereum#8)
- accounts: simulated backend consensus engine option and immediate tx indexing
- consensus/beacon: recognize all blocks as reached TTD with 0 TTD in chain config
- Add --rollup.historicalhttp CLI flag and fix backend iface
- Flags and interfaces for historical RPC requests (ethereum#12)
- Redirect historical RPC requests (ethereum#13)
- Use the pre-existing ethereum.NotFound error (ethereum#18)
- Add historical endpoint to TraceBlockByNumber and TraceBlockByHash (ethereum#19)
- Add historical endpoint to TraceTransaction (ethereum#20)
- Add historical endpoint to TraceCall (ethereum#21)
- optimism: fee params from info txi, update l1 cost func GPO params read (ethereum#15)
- add hardcoded addresses for fee payouts (ethereum#23)
- dynamic gas limit via engine API (ethereum#22)

Co-authored-by: Matthew Slipper <me@matthewslipper.com>
Co-authored-by: Joshua Gutow <jgutow@oplabs.co>
Co-authored-by: protolambda <proto@protolambda.com>
Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>
Co-authored-by: Maurelian <maurelian@protonmail.ch>
siddharth0a referenced this pull request in siddharth0a/go-ethereum Apr 10, 2024
come-maiz pushed a commit to come-maiz/go-ethereum that referenced this pull request Sep 19, 2024
ryanschneider pushed a commit to ryanschneider/go-ethereum that referenced this pull request Jan 30, 2025
scharissis pushed a commit to scharissis/go-ethereum that referenced this pull request Feb 3, 2025
fjl added a commit that referenced this pull request Mar 17, 2025
This PR is #2 of a 3-part series that implements the new log index
intended to replace core/bloombits.
Based on #31079
Replaces #30370

This part replaces the old bloombits based log search logic in
`eth/filters` to use the new `core/filtermaps` logic.

FilterMaps data structure explanation:
https://gist.github.com/zsfelfoldi/a60795f9da7ae6422f28c7a34e02a07e

Log index generator code overview:
https://gist.github.com/zsfelfoldi/97105dff0b1a4f5ed557924a24b9b9e7

Search pattern matcher code overview:
https://gist.github.com/zsfelfoldi/5981735641c956afb18065e84f8aff34

Note that the possibility of a tree hashing scheme and remote proof
protocol are mentioned in the documents above but they are not exactly
specified yet. These specs are WIP and will be finalized after the local
log indexer/filter code is finalized and merged.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
totovskimartin referenced this pull request in totovskimartin/go-ethereum Mar 18, 2025
totovskimartin referenced this pull request in totovskimartin/go-ethereum Mar 18, 2025
[CI:Build] commiting on task #2
bharath-123 pushed a commit to bharath-123/go-ethereum that referenced this pull request Mar 25, 2025
* add buf config and generated grpc code

* poc e2e grpc communication

* comment out panicking code

* logging help

* now reads cli args. now stops grpc server on shutdown.

* add mutex to GRPCServerHandler

update readme

containerize w/ github action to build and push to ghcr (ethereum#3)

fix gh action syntax (ethereum#4)

* containerize w/ github action to build and push to ghcr

* fix gh action yml syntax

* enable manual trigger

* fix syntax

build and push manually (ethereum#5)

* containerize w/ github action to build and push to ghcr

* fix gh action yml syntax

* enable manual trigger

* fix syntax

* dont use github action, do it ourselves

* push manually

Feature/containerize (ethereum#6)

* containerize w/ github action to build and push to ghcr

* fix gh action yml syntax

* enable manual trigger

* fix syntax

* dont use github action, do it ourselves

* push manually

* correct multi line

update SubmitTransaction to send tx to metro

ethclient: ensure returned subscription is nil on error (ethereum#26976)

core/state, trie: remove Try prefix in Trie accessors (ethereum#26975)

This change renames StateTrie methods to remove the Try* prefix.

We added the Trie methods with prefix 'Try' a long time ago, working
around the problem that most existing methods of Trie did not return the
database error. This weird naming convention has persisted until now.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

metrics/librato: ensure resp.body closed (ethereum#26969)

This change ensures that we call Close on a http response body, in various places in the source code (mostly tests)

core/vm: use atomic.Bool (ethereum#26951)

Make use of new atomic types
---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

core/bloombits: use atomic type (ethereum#26993)

core/state: use atomic.Bool (ethereum#26992)

graphql: fix data races (ethereum#26965)

Fixes multiple data races caused by the fact that resolving fields are done concurrently by the graphql library. It also enforces caching at the stateobject level for account fields.

eth/tracers/native: prevent panic for LOG edge-cases (ethereum#26848)

This PR fixes OOM panic in the callTracer as well as panicing on
opcode validation errors (e.g. stack underflow) in callTracer and
prestateTracer.

Co-authored-by: Martin Holst Swende <martin@swende.se>

internal/debug: add log.logfmt flag to set logging to use logfmt (ethereum#26970)

docs: update outdated DeriveSha docs comment (ethereum#26968)

add localnet genesis

update metro-transactions dep

Adding features to mempool to support our pre-ordered txs (ethereum#2)

* Adding features to mempool to support our pre-ordered txs

* Add framing for gRPC to execute blocks

* Remove public engine API call

* Fix circular dependencies

* Updated to use new Init, and fill out starting attributes

* Add clear astriaordered, cleanup

* readme fix

* add bash and jq to final docker image

* make txpool interface

* no more panics, update DoBlock to also update state + store block

* cleanup

* set post-merge at genesis

* cleanup

* doc update

* remove txpool interface changes

* cleanup

* cleanup

* build and push images wih tags defined by git tags

* build for multiple architectures. use docker-metadata action for semver

* add push: true

* only build arm for git tags/releases

---------

Co-authored-by: Jesse Snyder <jessetsnyder@gmail.com>
Co-authored-by: elizabeth <elizabethjbinks@gmail.com>

tag image with latest for builds from astria branch (ethereum#8)

rename state_root to block_hash

use FROM --platform=$BUILDPLATFORM to build arm images correctly (ethereum#9)

use v4 of build and push action (ethereum#10)

* use FROM --platform=$BUILDPLATFORM to build arm images correctly

* use v4 of docker build and push

fix arm builds. only build arm for tags and merges to default branch. (ethereum#12)

* fix arm builds. only build arm for tags and merges to default branch.

* fix gh action function syntax

* more correct comment

* build for semver tags

Features and fixes needed for contract deployment test (ethereum#13)

* add and remove tx from geth mempool so forge can deploy a contract

* pass metro addr and port by flag

* fixes from pr feedback

* formatting

implement FinalizeBlock gRPC call

bump metro-transactions dep

Update Protos (ethereum#16)

* uses new protos

* remove old protos

update deps

update deps

no more unknown/unknown image (ethereum#19)

* no more unknown/unknown image

* hardcode condition

Changing from prev_state_root to prev_block_hash

remove metro

integrate submission to sequencer

log updates

use env vars for chain id/tendermint endpoint

rename to cometbft

Make the environment variables actually work

cleaner

simple logging change

removed sleep before getPayload by removing goroutine in buildPayload

removed unneeded comment

removed for loop from buildPayload

Remove direct sequencer submission

cleanup go.mod

Migrate to the v1alpha1 API

Missed pieces

set genesis block as head/safe/final

remove all mentions of metro

Initial implementation of Execution v1alpha2 api

Integrate updates

remove need for consensus api

Updates

small updates

Update grpc/execution/server.go

Co-authored-by: noot <36753753+noot@users.noreply.github.com>

logging

remove unused dependency

Mark the chain 'finalized' on startup
bharath-123 pushed a commit to bharath-123/go-ethereum that referenced this pull request Mar 25, 2025
Updates the codeowners and sets a new package repo for `astria-geth`
repo.

Once this is merged, I can push the astria specific tags and we will get
built images for old tags on this repo.
sivaratrisrinivas pushed a commit to sivaratrisrinivas/go-ethereum that referenced this pull request Apr 21, 2025
This PR is ethereum#2 of a 3-part series that implements the new log index
intended to replace core/bloombits.
Based on ethereum#31079
Replaces ethereum#30370

This part replaces the old bloombits based log search logic in
`eth/filters` to use the new `core/filtermaps` logic.

FilterMaps data structure explanation:
https://gist.github.com/zsfelfoldi/a60795f9da7ae6422f28c7a34e02a07e

Log index generator code overview:
https://gist.github.com/zsfelfoldi/97105dff0b1a4f5ed557924a24b9b9e7

Search pattern matcher code overview:
https://gist.github.com/zsfelfoldi/5981735641c956afb18065e84f8aff34

Note that the possibility of a tree hashing scheme and remote proof
protocol are mentioned in the documents above but they are not exactly
specified yet. These specs are WIP and will be finalized after the local
log indexer/filter code is finalized and merged.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
rezbera added a commit to rezbera/bera-geth that referenced this pull request Jun 19, 2025
* impl with fork-awareness

* Update protocol_params.go

* remove the change comments

* hak

* Update eip1559.go

* Update config.go

* Update protocol_params.go

* renove forkstuff

* Update genesis.go

* Update eip1559.go

* Update eip1559.go

* Update config.go

* Check for isBerachain

* feat(BRIP-2): Gas Fee Modifications

* make fork aware

* more fork aware

* more prague1 stuff

* Move all changes except EIP-1559 to prepare-fork branch

* Reset all files except EIP-1559 to match master

* fix build

* resolve conflict

* nit

* empty bera configs

* defaults

* undo unneeded changes

* undo

* Changelog

---------

Co-authored-by: Rez <rez@berachain.com>
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

Successfully merging this pull request may close these issues.

2 participants