Comments (10)
ok so I think the docs should just outline that there is this kind of attack vendor, right?
when I understand right the following check would generally be sufficient to ensure the correct fee
and gasPrice
of the inner tx is being used:
require(Some(txhash) == Auth.tx_hash, "Inner transaction has been tampered with")
from protocol.
This is addressed by #513 - and in Ceres this is handled at the protocol level.
from protocol.
@cytadela8 Is this a check the developer needs to take care of? Can you elaborate a bit more about the problem?
Asking because @mitch-lbw is implementing a multsig example for generalized accounts.
from protocol.
@marc0olo any follow up on this?
from protocol.
I think I didn't really understand the problem back then and never had a deep look. afaik @mitch-lbw is about to finish the simple usecase for MultiSig using generalized accounts.
not sure what should be updated in the docs.
from protocol.
@cytadela8 can you please explain the issues you see? I currently unfortunately cannot retrace your considerations since interacting with GA is still contract interaction und thus is validated concerning gas and fee consumption ...
from protocol.
So this is what I recall from this discussion...
Remember that for a GAMetaTx the signature is, in effect, the calldata; and the signature check is the authentication function. So a malicious miner could change the Fee
and the GasPrice
and thus get more reward for the transaction - to counter this you'd have to check that Fee
and GasPrice
are sensible in the authentication function (either by having a pre-set range or by adding them as arguments to the authentication function).
from protocol.
I think I still don't 100% understand this. does this mean that the Fee
and GasPrice
set for the GAMetaTx
(e.g. SpendTx) are irrelevant for the execution of the auth function?
from the solution point of view I would prefer providing this information in the arguments of the auth function.
@hanssv can you share a small example how this would look like for a SpendTx
for example? just wondering
from protocol.
GAMetaTx contains a fee for the Meta part, and a fee for the inner tx (e.g. SpendTx). The inner tx is hashed and the hash is available to the authentication function. The outer fee (and gas price) has to be protected explicitly - this could look something like:
contract GAAuth =
stateful entrypoint authorize(fee: int, gasprice: int, txhash: hash, ...) : bool =
require(fee == Call.fee, "Fee has been tampered with")
require(gasprice == Call.gas_price, "Gas preice has been tampered with")
require(Some(txhash) == Auth.tx_hash, "Inner transaction has been tampered with")
...
from protocol.
Remember that for a GAMetaTx the signature is, in effect, the calldata; and the signature check is the authentication function. So a malicious miner could change the
Fee
and theGasPrice
and thus get more reward for the transaction - to counter this you'd have to check thatFee
andGasPrice
are sensible in the authentication function (either by having a pre-set range or by adding them as arguments to the authentication function).
Note to self: Adding them as arguments to the authentication function is just making the work of the malicious miner a bit harder. Nothing stops the miner from changing the AuthData in the call.
from protocol.
Related Issues (20)
- Document FSM ID
- Missing content and examples in contracts/contract_life_cycle.md
- Add built-ins to sophia-stdlib HOT 1
- Client reconnect should be cleaned out from documentation
- Document that sideeffects from failed protected remote calls are rolled backed HOT 1
- Name AE "coins" instead of "tokens"
- Document that inner transaction of PayingFor should be signed with `inner_tx` in prefix
- The link to outdated whitepaper leads to 404 page HOT 1
- Clarify measuring of inner tx length for PayingFor's gas HOT 3
- Hidden dual mining in T-Rex
- Is "off-chain" a single word or two?
- Is there a case when proof of inclusion contains multiple trees in a single key?
- `gas_price` field of Contract call looks suspicious in state channels
- How should be encoded key of contract calls' state tree?
- Inconsistent naming of MPTree entries
- Consider using PING/PONG on WebSocket protocol level instead of explicit messages
- mkdocs: 404 page misses styles
- Document name update transaction v2
- Document ping v2
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 protocol.