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

Expose mobile http server #2

Merged
merged 19 commits into from
Jul 6, 2018
Merged

Expose mobile http server #2

merged 19 commits into from
Jul 6, 2018

Conversation

cmcewen
Copy link
Contributor

@cmcewen cmcewen commented May 16, 2018

No description provided.

Copy link

@annakaz annakaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Member

@marekolszewski marekolszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with comments.

mobile/geth.go Outdated
@@ -76,6 +76,12 @@ type NodeConfig struct {

// Listening address of pprof server.
PprofAddress string

// Host of the http server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete before merging?

Version: params.Version,
DataDir: datadir,
KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores!
Name: clientIdentifier,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this line is showing ups as different because of whitespaces changes. Consider running gofmt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add a TODO here to revisit this to explore using IPC instead of a websocket.

@cmcewen cmcewen merged commit 5449dc5 into master Jul 6, 2018
ashishb added a commit that referenced this pull request Mar 22, 2019
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, #1 was not happening properly and #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
```
ashishb added a commit that referenced this pull request Mar 22, 2019
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, #1 was not happening properly and #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
```
ashishb added a commit that referenced this pull request Mar 22, 2019
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, #1 was not happening properly and #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
```
ashishb added a commit that referenced this pull request Mar 23, 2019
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, #1 was not happening properly and #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
```
ashishb added a commit that referenced this pull request Mar 23, 2019
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, #1 was not happening properly and #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
```
nambrot pushed a commit that referenced this pull request Apr 1, 2019
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, #1 was not happening properly and #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
```
@mcortesi mcortesi deleted the expose-server branch December 4, 2019 23:31
bowd added a commit that referenced this pull request Jul 29, 2020
Fix permalink issue for getting started docs
mcortesi pushed a commit that referenced this pull request Feb 25, 2021
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()`
mcortesi pushed a commit that referenced this pull request Feb 25, 2021
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()`
oneeman pushed a commit that referenced this pull request Mar 19, 2021
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()`
oneeman pushed a commit that referenced this pull request Mar 22, 2021
* Make tx pool fee check logic match the logic in state_transition.go

* Improve non-native currency fee tx handling (#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>
piersy added a commit that referenced this pull request Feb 2, 2024
Ensures that for mainnet, alfajores and baklava, nodes will return the correct block gas limit up to the gingerbread fork even if they are not archive nodes when running in eth compatibility mode (I.E. --disablerpcethcompatibility is not set). More detail can be found here: #2214

Also includes a small re-factor of GetBlockByNumber and GetBlockByHash to reduce the depth of nesting.

This change is not backwards compatible since it is changing what is returned by the rpc for historical blocks.
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.

3 participants