EN ▼
Favorites
My Favorites
View All
Market Cap Price 24h%

Disclaimer: Content does not constitute investment advice. Trading involves risks—please invest with caution!

Solana 托管测试展示如何拒绝重新报价

2026-11-09 00:20:47
Bookmark

Solana开发者Abdullah推出防篡改代币报价测试方案

Solana开发者Abdullah(推特账号:@rustacean_sol)于11月8日发布了一项针对“可编辑代币报价”漏洞的测试方案。该问题源于交易执行前的时间差:买家可能以某一价格签署交易,而卖家在此前更新了报价。

为解决此问题,Abdullah开发的托管程序(Escrow Program)要求买家对其预期支付金额进行签名确认。如果最终报价与买家签名时的预期金额不符,程序将拒绝该笔交易。

“Take协议会记录做市商(Taker)看到的原始价格,并在价格发生变更时使交易失败。”—— Abdullah (@rustacean_sol)
2026年11月8日

买家签名的机制

在该示例场景中,卖家将一枚代币锁定在托管账户中,并指定希望换取的另一类代币数量。在报价开放期间,卖家有权修改目标数量或截止时间。

买家的接受指令中包含一个 expected_receive(预期接收量)字段。在转移任何代币之前,托管代码会将该值与链上存储的金额进行比较。

假设买家签署同意支付100个单位,但卖家的更新操作(改为120个单位)先一步生效。当程序读取数据时发现两者不一致,交换流程随即中止。仓库中发布的LiteSVM输出记录显示,该“旧价格拒绝”测试已通过。另一项单独的测试则记录了在更新价格后成功完成的交易。这两项均为来自开发者社区项目的本地测试。

为何此项检查至关重要

虽然屏幕界面可以在买家打开报价的瞬间展示当前状态,但程序必须在交易实际执行时强制约束买家的条款。金额检查确保价格与买家签署的内容保持一致,而截止时间则有独立的检查机制,用于对比当前的链上时间。

根据Solana的交易规则,执行失败会导致交易的状态变更被回滚。然而,即使处理失败,网络手续费依然会被扣除。对于托管接口而言,这一区别为买家提供了明确的操作指引:即在重新签署之前,刷新报价页面并仔细审查新的价格条件。

Disclaimer:

All content published on this website, including hyperlinks, related applications, forums, blogs, and other media accounts, originates from third-party platforms and their users. CoinMarketInsight makes no representations or warranties of any kind regarding the website or its content. All blockchain-related data and materials are provided for informational and research purposes only and do not constitute financial, legal, or investment advice. Users and third parties are solely responsible for the content they publish. CoinMarketInsight shall not be liable for any losses arising from the use of this website. You should exercise caution and conduct your own independent research, review, analysis, and verification before making any decisions.

Read Full Article
More News
TOP

TOP